package com.itheima.homework.homework2;

/**
 * @Author 王加鑫
 * @Date 2021/5/10 19:37
 * @Version 1.0
 */
public class Demo2 {
    public static void main(String[] args) {
        // 创建对象，并初始化数据
        Person p1 = new Person("张三",23);
        Person p2 = new Person("李四",24);
        // 输出对象中数据
        System.out.println(p1.toString());
        System.out.println(p2);
    }

}



class Person {
    private String name;
    private int age;
    /*
        请补充代码！
    */
    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return name + "..." + age;
    }
}
